package com.qk.management.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qk.common.PageResult;
import com.qk.dto.customer.CustomerDTO;
import com.qk.entity.Customer;
import com.qk.management.mapper.CustomerMapper;
import com.qk.management.service.CustomerService;
import com.qk.vo.customer.CustomerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/*
 *  @author SHCJ
 *  @created 2025/10/16 18:15
 *  @description
 */
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public PageResult<CustomerVO> selectByPage(CustomerDTO dto) {
        PageHelper.startPage(dto.getPage(),dto.getPageSize());
        PageInfo<CustomerVO> pageInfo =  new PageInfo<>(this.customerMapper.selectByPage(dto));
        return new PageResult<>(pageInfo.getTotal(), pageInfo.getList());
    }
}
